home *** CD-ROM | disk | FTP | other *** search
- /*====================================================
- ARTemis
- (version 1.3)
- FM-TOWNS 用ペイントツール
-
- by 松内 良介 1994
- ====================================================*/
- /*
- guisub.c
- 拡張ライブラリII をもっとラクに使うための補助関数群
-
- 兄弟ウィンドウ関係の取得/設定
- ウィンドウのユーザー枠の座標を得る
- 描画原点を(0,0)に設定/復帰
- クリップ/ビジブル領域を画面全体に設定/復帰
- 12ドット文字表示
-
- int RM_init(void)
- void RM_end(void)
-
- void RM_getHyper(int objId, HYPER *hyp)
- void RM_getFrame(int idObj, FRAME *fr)
- void RM_setHyper(int objId, HYPER *hyp)
- void RM_setChColor(int objId, int col)
- void RM_moveCenter(int objId)
- void RM_getMoveFrame(FRAME *fr)
-
- void RM_getWinUserFrame(int id, FRAME *user)
-
- void RM_raise(int kobj)
- int RM_isTopInBros(int kobj)
-
- void RM_setOriginZero(void)
- void RM_recoverOrigin(void)
- void RM_setClipVisibleAllScr(void)
- void RM_setClipAnyFrame(int id, FRAME *fr)
- void RM_recoverClipVisible(void)
-
- void RM_adjustFrame(int kobj, int baseobj, FRAME *parm)
- void RM_adjustWinUser(int idWin, FRAME *parm)
-
- int RM_callSimpleFDG(int baseId, int noselId,
- char *title,char *ok,char *cancel,
- char *wildext, int flag, char *pathbuf)
- void RM_putstring12(char *egbwork, int x,int y, char *str,
- int col, int bold)
- void RM_setScrollRange(int idSBar, int nDisp, int nAll, int bRedraw)
- void RM_setScrollPos(int idSBar, int nPos, int bRedraw)
- int RM_getScrollPos(int idSBar)
- void RM_setClipWinUser(int idWin, WINCLIP **clipstack)
- void RM_resetClipWinUser(WINCLIP *clipstack)
- void RM_roundFramePosition(int idWin, int nx, int ny)
- void RM_initRadioButton(int *idBtnAry, int btnNum, int *sel)
- void RM_pushRadioButton(int idBtn,int idBase,
- int *idBtnAry, int btnNum, int *sel)
- void RM_setMosCsr(int colorMode, int csrType)
-
- void RM_setFileDlgStyle(int style)
-
-
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <winb.h>
- #include <te.h>
- #include <fntb.h>
- #include <gui.h>
- #include <file_dlg.h>
- #include <ctype.h>
- #include <fnt.h>
-
- #include <egb.h>
- #include <wgb.h>
- #include <msdos.cf>
-
- #include "guisub.h"
- #include "egbmac.h"
- #include "wgbmac.h"
-
- #define _iskanji(c) (((c)&0xff) >= 0x81 && ((c)&0xff)<=0x9f || \
- ((c)&0xff) >= 0xe0 && ((c)&0xff)<=0xfc)
- #define _iskanji1(kcode) ((((kcode)>>8)&0xff) <= 0x97)
-
- #define WHITE 15
- #define BLACK 8
- #define WINBACK 6
- #define RED 10
- #define GRAY 7
-
- /*--------------------------------------------------------*/
- /* このモジュールの初期化 */
- /*--------------------------------------------------------*/
-
- static int font12seg; // 12dot font が存在するセグメント
-
- int RM_init(void)
- {
- extern int mma_allocSeg(char* segname);
- font12seg = mma_allocSeg("FONT");
- return 0;
- }
-
- void RM_end(void)
- {
- }
-
- /*--------------------------------------------------------*/
- /* ハイパー/枠の設定・取得 */
- /*--------------------------------------------------------*/
-
- void RM_getHyper(int objId, HYPER *hyp)
- {
- MMI_SendMessage(objId, MM_GETHYPER, 1, hyp);
- }
-
- void RM_getFrame(int idObj, FRAME *fr)
- {
- HYPER hyp;
- MMI_SendMessage(idObj, MM_GETHYPER, 1, &hyp);
- *fr = hyp.fr;
- }
-
- void RM_setHyper(int objId, HYPER *hyp)
- {
- MMI_SendMessage(objId, MM_SETHYPER, 1, hyp);
- }
-
- void RM_setChColor(int idObj, int col)
- {
- HYPER hyp;
- MMI_SendMessage(idObj, MM_GETHYPER, 1, &hyp);
- hyp.clr.ch = col;
- MMI_SendMessage(idObj, MM_SETHYPER, 1, &hyp);
- }
-
- void RM_moveCenter(int objId)
- {
- HYPER h;
- FRAME fr,frScr;
- WINCTRL *pCtrl;
- int wid,ht;
- MMI_GetControl(&pCtrl);
- frScr = pCtrl->bound;
- MMI_SendMessage(objId, MM_GETHYPER, 1, &h);
- wid = h.fr.rdwx - h.fr.lupx + 1;
- ht = h.fr.rdwy - h.fr.lupy + 1;
- fr.lupx = ((frScr.rdwx - frScr.lupx+1) - wid) / 2;
- fr.lupy = ((frScr.rdwy - frScr.lupy+1) - ht ) / 2;
- fr.rdwx = fr.lupx + wid - 1;
- fr.rdwy = fr.lupy + ht - 1;
- MMI_SendMessage(objId, MM_MOVE, 1, &fr);
- }
-
- void RM_getMoveFrame(FRAME *fr)
- {
- WINCTRL *ctrl;
- MMI_GetControl(&ctrl);
- if (fr != NULL)
- *fr = ctrl->move;
- }
-
- /*--------------------------------------------------------*/
- /* 兄弟ウィンドウ関係の取得/設定 */
- /*--------------------------------------------------------*/
-
- void RM_raise(int kobj)
- /* 兄弟ウィンドウ内で一番上にもってくる */
- {
- int base;
- base = TL_getObjectPtr(kobj)->base;
- if (base < 0)
- return;
- MMI_SendMessage(kobj, MM_DETACH, 0);
- MMI_SendMessage(kobj, MM_ATTACH, 2, base, -1) ;
- }
-
- int RM_isTopInBros(int kobj)
- /* 兄弟ウィンドウ内で一番上かどうかを調べる */
- {
- OBJECT *pobj,*pbase;
- pobj = TL_getObjectPtr(kobj);
- pbase = TL_getObjectPtr(pobj->base);
- if (pbase->slave == pobj->llevel)
- return 1;
- else
- return 0;
- }
-
- /*--------------------------------------------------------*/
- /* ウィンドウのユーザー枠の座標を得る */
- /*--------------------------------------------------------*/
-
- void RM_getWinUserFrame(int id, FRAME *user)
- {
- HYPER hyp;
- FRAME frUser,frResize;
- MMI_SendMessage(id, MM_GETUSER, 2, &frUser, &frResize);
- MMI_SendMessage(id, MM_GETHYPER, 1, &hyp);
- frUser.lupx += hyp.fr.lupx;
- frUser.lupy += hyp.fr.lupy;
- frUser.rdwx = frUser.lupx + frUser.rdwx - 1;
- frUser.rdwy = frUser.lupy + frUser.rdwy - 1;
- if (user != NULL)
- *user = frUser;
- }
-
- /*--------------------------------------------------------*/
- /* 描画原点を(0,0)に設定/復帰 */
- /*--------------------------------------------------------*/
-
- typedef struct stag_orig {
- struct stag_orig *next;
- POINT ptOrigStack;
- } ORIGSTACK;
-
- static ORIGSTACK *ostack = NULL;
-
- void RM_setOriginZero(void)
- {
- static POINT ptNewOrig = {0,0};
- ORIGSTACK *pos;
- pos = TL_calloc(1, sizeof(ORIGSTACK));
- pos->next = ostack;
- ostack = pos;
- MG_PushOrigin(&ptNewOrig, &pos->ptOrigStack);
- }
-
- void RM_recoverOrigin(void)
- {
- ORIGSTACK *pos;
- pos = ostack;
- ostack = ostack->next;
- MG_PopOrigin(&pos->ptOrigStack);
- TL_free(pos);
- }
-
- /*--------------------------------------------------------*/
- /* クリップ/ビジブル領域を画面全体に設定/復帰 */
- /*--------------------------------------------------------*/
-
- typedef struct _tag_cvstack {
- struct _tag_cvstack *next;
- WINCLIP *pwcClipStack;
- WINCLIP *pwcVisibleStack;
- int type;
- } CVSTACK;
-
- #define STACK_PUSHCLIP 0
- #define STACK_BEGINUPDATE 1
-
- static CVSTACK *cvstack = NULL;
-
- void RM_setClipVisibleAllScr(void)
- {
- CVSTACK *pcv;
- FRAME frAllScr;
- WINCLIP *pWinClip;
- WINCTRL *pWinCtrl;
- /* 画面全体を表す WINCLIP リストを作成 */
- MMI_GetControl(&pWinCtrl);
- frAllScr = pWinCtrl->bound;
- pWinClip = WIN_getClipMemory(&frAllScr, NULL);
- /* CVSTACKを作成、リストに追加 */
- pcv = TL_calloc(1, sizeof(CVSTACK));
- pcv->next = cvstack;
- cvstack = pcv;
- /* pWinClip をクリップ領域・ビジブル領域として設定 */
- WIN_pushVisible(WIN_copyClip(pWinClip), &(pcv->pwcVisibleStack));
- WIN_pushClip(pWinClip, &(pcv->pwcClipStack));
- pcv->type = STACK_PUSHCLIP;
- }
-
- void RM_setClipAnyFrame(int id, FRAME *fr)
- {
- CVSTACK *pcv;
- /* CVSTACKを作成、リストに追加 */
- pcv = TL_calloc(1, sizeof(CVSTACK));
- pcv->next = cvstack;
- cvstack = pcv;
- /* クリップ領域を設定 */
- pcv->pwcVisibleStack = NULL;
- HYPER hyp;
- FRAME frBackup;
- RM_getHyper(id, &hyp);
- frBackup = hyp.fr;
- hyp.fr = *fr;
- RM_setHyper(id, &hyp);
- WIN_beginUpDateObj(id, &(pcv->pwcClipStack));
- hyp.fr = frBackup;
- RM_setHyper(id, &hyp);
- pcv->type = STACK_BEGINUPDATE;
- }
-
- void RM_recoverClipVisible(void)
- {
- CVSTACK *pcv;
- pcv = cvstack;
- cvstack = cvstack->next;
- if (pcv->type == STACK_PUSHCLIP)
- {
- if (pcv->pwcClipStack != NULL)
- WIN_popClip(pcv->pwcClipStack);
- if (pcv->pwcVisibleStack != NULL)
- WIN_popVisible(pcv->pwcVisibleStack);
- }
- else if (pcv->type == STACK_BEGINUPDATE)
- {
- if (pcv->pwcClipStack != NULL)
- WIN_endUpDateObj(pcv->pwcClipStack);
- if (pcv->pwcVisibleStack != NULL)
- WIN_popVisible(pcv->pwcVisibleStack);
- }
- TL_free(pcv);
- }
-
- /*--------------------------------------------------------*/
- /* 他の部品をベースに部品の位置・大きさを設定 */
- /*--------------------------------------------------------*/
-
- void RM_adjustFrame(int kobj, int baseobj, FRAME *parm)
- {
- HYPER hyp, hypBase;
- MMI_SendMessage(kobj, MM_GETHYPER, 1, &hyp);
- MMI_SendMessage(baseobj, MM_GETHYPER, 1, &hypBase);
- #define DO(t1, t2, t3) \
- if (parm->t1 >= 0) \
- hyp.fr.t1 = hypBase.fr.t2 + parm->t1; \
- else \
- hyp.fr.t1 = hypBase.fr.t3 + 1 + parm->t1;
- DO(lupx, lupx, rdwx)
- DO(lupy, lupy, rdwy)
- DO(rdwx, lupx, rdwx)
- DO(rdwy, lupy, rdwy)
- #undef DO
- MMI_SendMessage(kobj, MM_SETHYPER, 1, &hyp);
- }
-
- void RM_adjustWinUser(int idWin, FRAME *parm)
- {
- HYPER hyp;
- FRAME frUser, frResize;
- MMI_SendMessage(idWin, MM_GETHYPER, 1, &hyp);
- MMI_SendMessage(idWin, MM_GETUSER, 2, &frUser, &frResize);
- #define DO(t1, t2, t3) \
- if (parm->t1 >= 0) \
- frUser.t1 = hyp.fr.t2 + parm->t1; \
- else \
- frUser.t1 = hyp.fr.t3 + 1 + parm->t1;
- DO(lupx, lupx, rdwx)
- DO(lupy, lupy, rdwy)
- DO(rdwx, lupx, rdwx)
- DO(rdwy, lupy, rdwy)
- #undef DO
- frUser.rdwx = frUser.rdwx - frUser.lupx + 1;
- frUser.rdwy = frUser.rdwy - frUser.lupy + 1;
- frUser.lupx = frUser.lupx - hyp.fr.lupx;
- frUser.lupy = frUser.lupy - hyp.fr.lupy;
- MMI_SendMessage(idWin, MM_SETUSER, 1, &frUser, &frResize);
- }
-
- /*--------------------------------------------------------*/
- /* ファイルダイアログの呼び出し */
- /*--------------------------------------------------------*/
-
- int RM_callSimpleFDG(int baseId, int noselId,
- char *title,char *ok,char *cancel,
- char *wildext, int flag, char *pathbuf)
- /*
- flag: FDG_NONE, FDG_MSLCT, FDG_TEXT, FDG_FILEONLY など
- FDG_MSLCT を指定している場合、*(int*)pathbuf にファイルの個数
- (返値が0でないときは無効)
- */
- {
- static char *extstr[] = {"*.*",NULL};
- int atr,ret,i;
- unsigned int select_cnt;
- char pathname[80];
- if (wildext != NULL)
- extstr[0] = wildext;
- else
- extstr[0] = "*.*";
- /* ファイルダイアログ以外の部品を選択不可にする */
- MTL_setFlagObj(noselId, MS_UNSELECT) ;
- /* ファイルダイアログのタイトル、表示位置を設定 */
- FDG_SetTitle(title, ok, cancel) ;
- HYPER h;
- FRAME fr;
- MMI_SendMessage(FDG_GetMainID(), MM_GETHYPER, 1, &h);
- fr.lupx = (640 - (h.fr.rdwx - h.fr.lupx + 1)) / 2;
- fr.lupy = (480 - (h.fr.rdwy - h.fr.lupy + 1)) / 2;
- FDG_SetFrame(fr);
- /* ファイルダイアログの表示 */
- ret = FDG_DspFileDlg(baseId, flag,NULL,extstr,&select_cnt);
- /* 「実行」が押されたならファイル名を取得 */
- if (ret > 0)
- {
- if (flag & FDG_MSLCT)
- *(int*)pathbuf = select_cnt;
- else
- {
- FDG_GetPathName(pathname, &atr, 0);
- strcpy(pathbuf, pathname);
- }
- }
- /* ファイルダイアログ以外の部品を選択可能にもどす */
- MTL_resetFlagObj(noselId, ~MS_UNSELECT) ;
- /* リターン */
- if (ret > 0)
- return 0;
- else
- return -1;
- }
-
- /*--------------------------------------------------------*/
- /* 12ドット文字表示 */
- /*--------------------------------------------------------*/
-
- void RM_putstring12(char *egbwork,int x,int y,char *str, int col,int bold)
- /* グローバル変数 font12seg の設定が必要 */
- {
- #define PUTBITBLOCK(x1,y1,x2,y2,dat) { \
- char para[16]; \
- DWORD(para)=(unsigned int)dat; WORD(para+4)=getds(); \
- WORD(para+6)=x1; WORD(para+8)=y1; \
- WORD(para+10)=x2; WORD(para+12)=y2; \
- WGB_putBlockColor(egbwork, 1, para); }
- int ds = getds();
- char fontbuf[24];
- EGB_color(egbwork, 0, col);
- EGB_writeMode(egbwork, 0);
- while (*str != 0)
- {
- if (_iskanji(*str))
- /* 全角文字の場合 */
- {
- int ofs, sjis = (*str)*256 + *(str+1), jis;
- jis = FNT_sjisToJis(sjis);
- if (_iskanji1(sjis))
- {
- ofs = ( ((jis>>8)-0x21)*94 + (jis&0xff) - 0x21)*24 + 0xc00;
- _movedata(font12seg, ofs, ds, (unsigned int)fontbuf, 24);
- }
- else // 第1水準じゃない場合
- {
- char font16buf[32];
- FNT_kanjiRead(16,16,jis,ds,font16buf);
- memset(fontbuf,0,24);
- int di=0;
- for (int i=0; i<16; i++)
- {
- unsigned short p;
- p = ((unsigned short)font16buf[i*2]<<8) |
- font16buf[i*2+1];
- p = (p&0xc000) | ((p&0x3c00)<<1) | ((p&0x3c0)<<2) |
- ((p&0x3c)<<3) | ((p&0x3)<<4);
- fontbuf[di*2] |= (p>>8) & 0xff;
- fontbuf[di*2+1] |= p & 0xff;
- if (i!=1 && i!=4 && i!=7 && i!=10)
- di++;
- }
- }
- PUTBITBLOCK(x,y,x+11,y+11,fontbuf);
- str++,str++;
- x += 12;
- }
- else
- /* ANK文字の場合 */
- {
- if (*str != ' ')
- {
- int ofs = (int)*str * 12;
- _movedata(font12seg, ofs, ds, (unsigned int)fontbuf, 12);
- PUTBITBLOCK(x,y,x+5,y+11,fontbuf);
- }
- str++;
- x += 6;
- }
- }
- }
-
- /*--------------------------------------------------------*/
- /* スクロールバー値の設定/取得 */
- /*--------------------------------------------------------*/
-
- void RM_setScrollRange(int idSBar, int nDisp, int nAll, int bRedraw)
- {
- int ptr,min,max,len,page;
- MMI_SendMessage(idSBar, MM_GETSCROLL, 5, &ptr,&min,&max,&len,&page);
- min = nDisp-1;
- max = nAll < nDisp ? nDisp-1 : nAll-1;
- ptr = _max(min, _min(max, ptr));
- MMI_SendMessage(idSBar, MM_SETSCROLL, 5, ptr,min,max, nDisp, page);
- if (bRedraw)
- MMI_SendMessage(idSBar, MM_SHOW, 0);
- }
-
- void RM_setScrollPos(int idSBar, int nPos, int bRedraw)
- {
- int ptr,min,max,len,page;
- MMI_SendMessage(idSBar, MM_GETSCROLL, 5, &ptr,&min,&max,&len,&page);
- ptr = _max(min, _min(max, min + nPos));
- MMI_SendMessage(idSBar, MM_SETSCROLL, 5, ptr,min,max, len, page);
- if (bRedraw)
- MMI_SendMessage(idSBar, MM_SHOW, 0);
- }
-
- int RM_getScrollPos(int idSBar)
- {
- int ptr,min,max,len,page;
- MMI_SendMessage(idSBar, MM_GETSCROLL, 5, &ptr,&min,&max,&len,&page);
- return ptr - min;
- }
-
- /*--------------------------------------------------------*/
- /* ウィンドウのユーザー領域にクリップを設定 */
- /*--------------------------------------------------------*/
-
- void RM_setClipWinUser(int idWin, WINCLIP **clipstack)
- {
- HYPER hyp;
- FRAME frUser,frBackup;
- RM_getHyper(idWin, &hyp);
- frBackup = hyp.fr;
- RM_getWinUserFrame(idWin, &frUser);
- hyp.fr = frUser;
- RM_setHyper(idWin, &hyp);
- WIN_beginUpDateObj(idWin, clipstack);
- hyp.fr = frBackup;
- RM_setHyper(idWin, &hyp);
- }
-
- void RM_resetClipWinUser(WINCLIP *clipstack)
- {
- WIN_endUpDateObj(clipstack);
- }
-
- /*--------------------------------------------------------*/
- /* ウィンドウの座標を n の倍数に補正 */
- /*--------------------------------------------------------*/
-
- void RM_roundFramePosition(int idWin, int nx, int ny)
- {
- HYPER hyp;
- MG_mosDisp(2);
- RM_getHyper(idWin, &hyp);
- int dx,dy;
- dx = -(hyp.fr.lupx % nx);
- dy = -(hyp.fr.lupy % ny);
- if (dx != 0 || dy != 0)
- WIN_moveWindow(idWin, dx,dy);
- MG_mosDisp(3);
- }
-
- /*--------------------------------------------------------*/
- /* ラジオボタン処理 */
- /*--------------------------------------------------------*/
-
- void RM_initRadioButton(int *idBtnAry, int btnNum, int *sel)
- {
- int i;
- for (i=0; i<btnNum; i++)
- MTL_resetFlagObj(idBtnAry[i], ~(MS_UNSELECT|MS_TOGGLE)) ;
- // MTL_setFlagObj(idBtnAry[*sel], (MS_UNSELECT|MS_TOGGLE)) ;
- MTL_setFlagObj(idBtnAry[*sel], MS_TOGGLE) ;
- }
-
- void RM_pushRadioButton(int idBtn,int idBase,
- int *idBtnAry, int btnNum, int *sel)
- {
- WINCLIP *clip;
- int i;
- for (i=0 ; i<btnNum; i++)
- if (idBtnAry[i] == idBtn)
- break;
- if (*sel != i)
- {
- WIN_beginUpDateObj(idBase, &clip);
- // MTL_resetFlagObj(idBtnAry[*sel], ~(MS_UNSELECT|MS_TOGGLE)) ;
- MTL_resetFlagObj(idBtnAry[*sel], ~MS_TOGGLE) ;
- MMI_SendMessage(idBtnAry[*sel], MM_SHOW, 0) ;
- *sel = i;
- // MTL_setFlagObj(idBtnAry[*sel], (MS_UNSELECT|MS_TOGGLE)) ;
- MTL_setFlagObj(idBtnAry[*sel], MS_TOGGLE) ;
- WIN_endUpDateObj(clip);
- }
- else
- {
- WIN_beginUpDateObj(idBase, &clip);
- MTL_setFlagObj(idBtnAry[*sel], MS_TOGGLE) ;
- MMI_SendMessage(idBtnAry[*sel], MM_SHOW, 0) ;
- WIN_endUpDateObj(clip);
- }
- }
-
- /*--------------------------------------------------------*/
- /* マウスカーソル形状の設定 */
- /*--------------------------------------------------------*/
-
- void RM_setMosCsr(int colorMode, int csrType)
- {
- unsigned int *coltbl;
- coltbl = MG_getColorTable(colorMode);
- if (colorMode == 0)
- SetMouse16(csrType, WHITE, BLACK);
- else if (colorMode == 1)
- SetMouse16(csrType, coltbl[WHITE] & 0xff, coltbl[BLACK] & 0xff);
- else if (colorMode == 2)
- SetMouse16(csrType, coltbl[WHITE]&0x7fff, coltbl[BLACK]&0x7fff);
- }
-
- /*--------------------------------------------------------*/
- /* メタID からクラス名を得る */
- /*--------------------------------------------------------*/
-
- char *RM_getMetaIdName(int metaId)
- {
- char *typename;
- if (metaId == MJ_DIALOGL40)
- typename = "ダイアログ型";
- else if (metaId == MJ_HYPER)
- typename = "ハイパー型";
- else if (metaId == MJ_ALERTL40)
- typename = "アラート型";
- else if (metaId == MJ_WINDOWL40)
- typename = "ウィンドウ型";
- else if (metaId == MJ_MSGL40)
- typename = "メッセージ型";
- else if (metaId == MJ_MENUL40)
- typename = "メニュー型";
- else if (metaId == MJ_BUTTONL40)
- typename = "ボタン型";
- else if (metaId == MJ_DBUTTONL40)
- typename = "ドローボタン型";
- else if (metaId == MJ_ICONL40)
- typename = "アイコンボタン型";
- else if (metaId == MJ_TICONL40)
- typename = "トグルアイコン型";
- else if (metaId == MJ_MITEML40)
- typename = "メニューアイテム型";
- else if (metaId == MJ_SCRLL40)
- typename = "スクロールバー型";
- else if (metaId == MJ_TEXTL40)
- typename = "テキスト型";
- else if (metaId == MJ_LMENUL40)
- typename = "リストメニュー型";
- else if (metaId == MJ_NUMBOXL40)
- typename = "数値入力パネル型";
- else
- typename = "<不明>";
- return typename;
- }
-
- /*--------------------------------------------------------*/
- /* ファイルダイアログの見た目を変更する */
- /*--------------------------------------------------------*/
-
- #if 0
- static void FDGdump(void)
- {
- int idWin;
- idWin = FDG_GetMainID();
- int depth = 0;
- void dumpObj(int id)
- {
- void indent(void)
- {
- int i;
- for (i=0; i<depth; i++)
- printf("| ");
- }
- OBJECT *pObj, *pBase;
- if (id <= 0 || (pObj = TL_getObjectPtr(id)) == NULL)
- { printf("*** no there %d ***\n",id); return; }
- pBase = (pObj->base > 0 ? TL_getObjectPtr(pObj->base) : NULL);
- indent();
- printf("┌Obj %4d %-20s\n", id,RM_getMetaIdName(pObj->meta));
- HYPER hyp;
- hyp = *(HYPER*)pObj->data;
- indent();
- printf("│ fr(%3d,%3d)-(%3d,%3d) ", hyp.fr.lupx, hyp.fr.lupy,
- hyp.fr.rdwx, hyp.fr.rdwy);
- printf("col(%d,%d,%d)\n", hyp.clr.fr, hyp.clr.back, hyp.clr.ch);
- indent();
- printf("└ base,slave,left,right=(%d,%d,%d,%d)\n",
- pObj->base,pObj->slave,pObj->llevel,pObj->rlevel);
- if (pObj->slave > 0)
- { depth++; dumpObj(pObj->slave); depth--; }
- if (pBase != NULL)
- if (pObj->llevel > 0 && pObj->llevel != pBase->slave)
- dumpObj(pObj->llevel);
- }
- dumpObj(idWin);
- }
- #endif
-
- #if 1
- void FDGdump(void)
- {
- int idWin;
- idWin = MJ_BASEOBJ;
- int depth = 0;
- void dumpObj(int id)
- {
- if (depth >= 2)
- return;
- void indent(void)
- {
- int i;
- for (i=0; i<depth; i++)
- printf("| ");
- }
- OBJECT *pObj, *pBase;
- if (id <= 0 || (pObj = TL_getObjectPtr(id)) == NULL)
- { printf("*** no there %d ***\n",id); return; }
- pBase = (pObj->base > 0 ? TL_getObjectPtr(pObj->base) : NULL);
- indent();
- printf("┌Obj %4d %-20s\n", id,RM_getMetaIdName(pObj->meta));
- HYPER hyp;
- hyp = *(HYPER*)pObj->data;
- indent();
- printf("│ fr(%3d,%3d)-(%3d,%3d) ", hyp.fr.lupx, hyp.fr.lupy,
- hyp.fr.rdwx, hyp.fr.rdwy);
- printf("col(%d,%d,%d)\n", hyp.clr.fr, hyp.clr.back, hyp.clr.ch);
- indent();
- printf("└ base,slave,left,right=(%d,%d,%d,%d)\n",
- pObj->base,pObj->slave,pObj->llevel,pObj->rlevel);
- if (pObj->slave > 0)
- { depth++; dumpObj(pObj->slave); depth--; }
- if (pBase != NULL)
- if (pObj->llevel > 0 && pObj->llevel != pBase->slave)
- dumpObj(pObj->llevel);
- }
- dumpObj(idWin);
- }
- #endif
-
- void RM_setFileDlgStyle(int style)
- {
- typedef struct
- {
- int objId;
- COLOR clr; /* 設定したい表示色 */
- int atrm; /* 設定したい表示属性 */
- FRAME fr; /* フレーム変更(相対値) */
- } PARTCHANGE;
- static PARTCHANGE change[] =
- {
- #define FR0 {0,0,0,0}
- #define STYLE {BLACK,WINBACK,BLACK}, MS_FRAMEL40|MS_UFRAMEL40
- #define STYLE2 {BLACK,BLACK,WHITE}, MS_FRAMEL40|MS_DFRAMEL40
- #define STYLE3 {BLACK,WINBACK,WINBACK}, MS_FRAMEL40|MS_UFRAMEL40
- #define STYLE4 {BLACK,WINBACK,WINBACK}, MS_FRAMEL40|MS_BFRAMEL40|MS_PANELL40
- #define BK BLACK
- #define MSGSTYLE2 {BK,WINBACK,BK},MS_OPAQUEL40
- { FDG_MAINDLG, STYLE, FR0 },
- { FDG_TITLE1, STYLE, {1,1,1,0} },
- { FDG_TITLE2, STYLE, {1,1,1,0} },
- { FDG_TITLEMSG, MSGSTYLE2,{1,1,1,1} },
- { FDG_CLSBTN, STYLE3, {0,0,2,2} },
- { FDG_DRVSLCTL, STYLE, FR0 }, // ドライブ選択←
- { FDG_DRVSLCTR, STYLE, FR0 }, // ドライブ選択→
- { FDG_DRVICON, STYLE, FR0 },
- { FDG_ALLDRVBTN,STYLE, FR0 }, // SHOW ALL 背景
- { FDG_ALLDRVDLG,STYLE, FR0 }, // SHOW ALL 背景
- { FDG_VOLLABEL, MSGSTYLE2,FR0 },
- { FDG_FREESIZE, MSGSTYLE2,FR0 },
- { FDG_CURDIR, STYLE2, FR0 },
- { FDG_MOVEDIR, STYLE, FR0 },
- { FDG_UPDIR, STYLE, FR0 },
- { FDG_LMENU, STYLE2, FR0 },
- { FDG_SCRLBAR, STYLE4, FR0 },
- { FDG_FNAMETXT, {RED,BK,WHITE},MS_FRAMEL40|MS_DFRAMEL40, FR0 },
- { FDG_EXECBTN, STYLE, FR0 },
- { FDG_CNCLBTN, STYLE, FR0 },
- { -1 }
- };
- PARTCHANGE *pc;
- for (pc = change; pc->objId >= 0; pc++)
- {
- HYPER hyp;
- FDG_GetObjData(pc->objId, &hyp);
- hyp.atrm = pc->atrm;
- hyp.clr = pc->clr;
- hyp.fr.lupx += pc->fr.lupx;
- hyp.fr.lupy += pc->fr.lupy;
- hyp.fr.rdwx += pc->fr.rdwx;
- hyp.fr.rdwy += pc->fr.rdwy;
- FDG_SetObjData(pc->objId, &hyp);
- }
- }
-
- /*--------------------------------------------------------*/
- /* オリジナル・ビジュアルエフェクト関数 */
- /*--------------------------------------------------------*/
-
- void MS_ve(int num, int flag, FRAME *fr, char *ptr)
- {
- if (flag == TRUE)
- {
- int ve = (num / 100) % 100;
- if (num == 9)
- /* 斜め線転送! 今は16色モードのみ。*/
- {
-
- }
- }
- else
- {
- int ve = num % 100;
- }
- }
-
-
-
-